fix: don't show version drop on landing page#611
Closed
AlexAndBear wants to merge 3 commits intomainfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the version dropdown was appearing on the landing page when it should only be visible on documentation pages.
Changes:
- Added logic to conditionally render the docs version dropdown based on the current page path
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| export default function DocsVersionDropdownNavbarItemWrapper(props: Props): ReactNode { | ||
| const location = useLocation(); | ||
| const isDocsPage = location.pathname.split('/').includes('docs') |
There was a problem hiding this comment.
The logic for detecting docs pages is fragile. A pathname like '/mydocs' or '/docs-info' would incorrectly match because 'docs' appears as a substring within a segment. Consider using a more precise check such as verifying that 'docs' is an exact segment match or checking if the pathname starts with '/docs/'.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
bs, closing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The version dropdown was appearing on the landing page (/) where it caused confusing navigation behavior. When users clicked the version selector from the landing page, Docusaurus defaulted to navigating to the Admin docs section, as it had no context about which documentation section (User, Admin, or Dev) the user intended to access.